

toastLog(device)

displayProp(device)


function testdemo(){
let obj={
    name:'dawn',
    age:21
}
let fn=function() {
    console.log('我是 function 类型');
}
console.log(typeof 1);       //number
console.log(typeof 'abc');   //string
console.log(typeof true);    //boolean
console.log(typeof undefined);  //undefined 
console.log(typeof fn);      //function
console.log(typeof (new Date) );  //object
console.log(typeof null);     //object
console.log(typeof [1,2,3]);  //object
console.log(typeof obj);      //object
}

function displayProp(obj){    
    var names=""; 
    var funcs="";      
    for(var name in obj){
        alert(typeof name)
       if (typeof name =="function"){
            funcs+=funcs+": "+obj[name]+"\n";  
       }else{
            names+=name+": "+obj[name]+"\n";  
       }
    }
    toastLog("属性如下:"+names);  
    toastLog("函数如下："+funcs);
}
